package com.scu.hotelsystem.service;

import com.scu.hotelsystem.dao.GuestDao;
import com.scu.hotelsystem.pojo.Guest;
import com.scu.hotelsystem.pojo.GuestSearch;
import com.scu.hotelsystem.pojo.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class GuestServiceImpl implements GuestService{

    @Autowired
    private GuestDao guestDao;
/*
    @Override
    public List<Guest> getGuestList() {

        return guestDao.getGuestList();
    }
*/

    @Override
    public List<Guest> getGuestListByPage(GuestSearch info) {
        return guestDao.getGuestListByPage((info.getPage()-1)*info.getLimit(),info.getLimit(),info);
    }

    @Override
    public int getGuestCount(GuestSearch info) {
        return guestDao.getGuestCount(info);
    }

    /*
    根据id删除房客
     */
    @Override
    public int delGuest(Integer id) {
        return guestDao.delGuest(id);
    }

    @Override
    public int addGuest(Guest guest) {
        return guestDao.addGuest(guest);
    }
}
